 
$(function(){
	// 根据ID查询项目信息
	getProjectInfoById();
});

function getProjectInfoById() {
	var id = $("#id").val();
	$.ajax({
		url : 'project-search!find.action',
		dataType: 'json',
		data: {
			"id": id
		},
		success : function(data) {
			Interceptor(data);
		     if(data!=null) {
		        //机构信息
		    	$("#li_name").html(data[0].project.organization.name);
		    	$("#li_organType").html(data[0].project.organization.organType);
		    	$("#li_organLevel").html(data[0].project.organization.organLevel);
		    	$("#li_province").html(data[0].project.organization.province.name);
		    	$("#li_organCode").html(data[0].project.organization.organCode);
		    	$("#li_address").html(data[0].project.organization.address);
		    	$("#li_postCode").html(data[0].project.organization.postCode);
		    	$("#li_contactUser").html(data[0].project.organization.contactUser);
		    	$("#li_contactPhone").html(data[0].project.organization.contactPhone);
		    	$("#li_contactMobile").html(data[0].project.organization.contactMobile);
		    	$("#li_contactEmail").html(data[0].project.organization.contactEmail);
		    	//项目信息
		    	$("#name").html(data[0].project.name);
		    	$("#regNumber").html(data[0].project.regNumber);
		    	$("#keywords").html(data[0].project.keywords);
		    	$("#sourceType").html(data[0].project.sourceType);
		    	if(data[0].project.sourceType=='国家级') {
		    		$("#ul_sourceTypeSec").show();
		    		$("#sourceTypeSec").html(data[0].project.sourceTypeSec);
		    	}
		    	$("#sponsors").html(data[0].project.sponsors);
		    	//项目组织信息
		    	if(data[0].projectOrganization!=null) {
		    		$("#principalName").html(data[0].projectOrganization.principalName);
		    		$("#principaCertificateType").html(data[0].projectOrganization.principaCertificateType);
		    		$("#principaCertificateNumber").html(data[0].projectOrganization.principaCertificateNumber);
		    		$("#principaTelephone").html(data[0].projectOrganization.principaTelephone);
		    		$("#principaPhone").html(data[0].projectOrganization.principaPhone);
		    		$("#principaEmail").html(data[0].projectOrganization.principaEmail);
		    	}
		    	// 伦理审查信息
		    	if(data[0].projectEthic!=null) {
		    		$("#ethicName").html(data[0].projectEthic.name);
		    		if(data[0].projectEthic.isRecords=='1') {
		    			$("#isRecords").html("是");
		    		}else if(data[0].projectEthic.isRecords=='0') {
		    			$("#isRecords").html("否");
		    		}
		    		$("#provinceCode").html(data[0].projectEthicProvinceName);
		    		$("#auditDate").html(data[0].projectEthic.auditDate);
		    		$("#approvalNumber").html(data[0].projectEthic.approvalNumber);
		    		$("#ethicTelephone").html(data[0].projectEthic.telephone);
		    		$("#ethicEmail").html(data[0].projectEthic.email);
		    		if(data[0].projectEthic.approvalFilePath!='') {
		    			$("#tteeFilePath_span").html('<a href="' + data[0].projectEthic.approvalFilePath + '" target="_blank" >查看附件</a>');
		    		}
		    		
		    	}
		    	// 研究设计信息
		    	$("#researchPurpose").html(data[0].project.researchPurpose);
		    	$("#researchScheme").html(data[0].project.researchScheme);
		    	$("#researchType").html(data[0].project.researchType);
		    	
		    	if(data[0].project.researchType=='观察性研究') {
		    		$("#ul_researchType_gc").show();
		    		$("#researchDesignTimer").html(data[0].project.researchDesignTimer);
		    	}else if(data[0].project.researchType=='干预性研究') {
		    		// 组信息列表
		    		$("#div_group_domain").show();
		    		var group_domainStr = '<DIV style="MARGIN-TOP: 10px" class=zhibiaoTitle>研究小组信息 &gt;&gt;</DIV>';
		    		if(data[0].projectGroupList!=null) {
			    		$(data[0].projectGroupList).each(function(i) {
			    			group_domainStr += '<ul class="class_researchType_gy" style="background-color: #EEEED1; padding-top: 15px; padding-bottom: 15px;">'
										      + '<li class="name">组别名称：</li>'
										      + '<li class="inpu">'
										      + data[0].projectGroupList[i].groupName
										      + '</li>'
										      + '<li class="name">满足条件：</li>'
										      + '<li class="inpu">'
										      +  data[0].projectGroupList[i].groupConditions
										      + '</li>'
										      + '<li class="name">干预类型：</li>'
										      + '<li class="inpu">'
										      + data[0].projectGroupList[i].interventionType
										      + '</li>'
										      + '<li class="name">干预措施：</li>'
										      + '<li class="inpu">'
										      + data[0].projectGroupList[i].interventionMeasures
										      + '</li>'
										    + '</ul>'
			    		});
			    	}
			    	$("#div_group_domain").html(group_domainStr);
		    	}else if(data[0].project.researchType=='其他') {
		    		$("#ul_researchType_qt").show();
		    		$("#researchTypeInfo").html(data[0].project.researchTypeInfo);
		    	}
		    	
		    	$("#researchDesignStartAndEnd").html(data[0].project.researchDesignStart + " 至 " + data[0].project.researchDesignEnd);
		    	// 研究领域
		    	var researchDomainStr = '';
		    	var researchDomainSecStr = '';
		    	// 判断一级
		    	if(data[0].project.researchDomain=='1001') {
		    		researchDomainStr='基础医学';
		    	}else if(data[0].project.researchDomain=='1002') {
		    		researchDomainStr='临床医学';
		    	}else if(data[0].project.researchDomain=='1003') {
		    		researchDomainStr='口腔医学';
		    	}else if(data[0].project.researchDomain=='1004') {
		    		researchDomainStr='公共卫生与预防医学';
		    	}else if(data[0].project.researchDomain=='1005') {
		    		researchDomainStr='中医学';
		    	}else if(data[0].project.researchDomain=='1006') {
		    		researchDomainStr='中西医结合';
		    	}else if(data[0].project.researchDomain=='1007') {
		    		researchDomainStr='药学';
		    	}else if(data[0].project.researchDomain=='1008') {
		    		researchDomainStr='中药学';
		    	}
		    	// 判断二级
		    	if(data[0].project.researchDomainSec=='100101') {researchDomainSecStr='人体解剖与组织胚胎学';}
				else if(data[0].project.researchDomainSec=='100102') {researchDomainSecStr='免疫学';}
				else if(data[0].project.researchDomainSec=='100103') {researchDomainSecStr='病原生物学';}
				else if(data[0].project.researchDomainSec=='100104') {researchDomainSecStr='病理学与病理生理学';}
				else if(data[0].project.researchDomainSec=='100105') {researchDomainSecStr='法医学';}
				else if(data[0].project.researchDomainSec=='100106') {researchDomainSecStr='放射医学';}
				else if(data[0].project.researchDomainSec=='100107') {researchDomainSecStr='航空、航天与航海医学';}
				else if(data[0].project.researchDomainSec=='100201') {researchDomainSecStr='内科学';}
				else if(data[0].project.researchDomainSec=='100202') {researchDomainSecStr='儿科学';}
				else if(data[0].project.researchDomainSec=='100203') {researchDomainSecStr='老年医学';}
				else if(data[0].project.researchDomainSec=='100204') {researchDomainSecStr='神经病学';}
				else if(data[0].project.researchDomainSec=='100205') {researchDomainSecStr='精神病与精神卫生学';}
				else if(data[0].project.researchDomainSec=='100206') {researchDomainSecStr='皮肤病与性病学';}
				else if(data[0].project.researchDomainSec=='100207') {researchDomainSecStr='影像医学与核医学';}
				else if(data[0].project.researchDomainSec=='100208') {researchDomainSecStr='临床检验诊断学';}
				else if(data[0].project.researchDomainSec=='100209') {researchDomainSecStr='护理学';}
				else if(data[0].project.researchDomainSec=='100210') {researchDomainSecStr='外科学';}
				else if(data[0].project.researchDomainSec=='100211') {researchDomainSecStr='妇产科学';}
				else if(data[0].project.researchDomainSec=='100212') {researchDomainSecStr='眼科学';}
				else if(data[0].project.researchDomainSec=='100213') {researchDomainSecStr='耳鼻咽喉科学';}
				else if(data[0].project.researchDomainSec=='100214') {researchDomainSecStr='肿瘤学';}
				else if(data[0].project.researchDomainSec=='100215') {researchDomainSecStr='康复医学与理疗学';}
				else if(data[0].project.researchDomainSec=='100216') {researchDomainSecStr='运动医学';}
				else if(data[0].project.researchDomainSec=='100217') {researchDomainSecStr='麻醉学';}
				else if(data[0].project.researchDomainSec=='100218') {researchDomainSecStr='急诊医学';}
				else if(data[0].project.researchDomainSec=='100301') {researchDomainSecStr='口腔基础医学';}
				else if(data[0].project.researchDomainSec=='100302') {researchDomainSecStr='口腔临床医学';}
				else if(data[0].project.researchDomainSec=='100401') {researchDomainSecStr='流行病与卫生统计学';}
				else if(data[0].project.researchDomainSec=='100402') {researchDomainSecStr='劳动卫生与环境卫生学';}
				else if(data[0].project.researchDomainSec=='100403') {researchDomainSecStr='营养与食品卫生学';}
				else if(data[0].project.researchDomainSec=='100404') {researchDomainSecStr='儿少卫生与妇幼保健学';}
				else if(data[0].project.researchDomainSec=='100405') {researchDomainSecStr='卫生毒理学';}
				else if(data[0].project.researchDomainSec=='100406') {researchDomainSecStr='军事预防医学';}
				else if(data[0].project.researchDomainSec=='100501') {researchDomainSecStr='中医基础理论';}
				else if(data[0].project.researchDomainSec=='100502') {researchDomainSecStr='中医临床基础';}
				else if(data[0].project.researchDomainSec=='100503') {researchDomainSecStr='中医医史文献';}
				else if(data[0].project.researchDomainSec=='100504') {researchDomainSecStr='方剂学';}
				else if(data[0].project.researchDomainSec=='100505') {researchDomainSecStr='中医诊断学';}
				else if(data[0].project.researchDomainSec=='100506') {researchDomainSecStr='中医内科学';}
				else if(data[0].project.researchDomainSec=='100507') {researchDomainSecStr='中医外科学';}
				else if(data[0].project.researchDomainSec=='100508') {researchDomainSecStr='中医骨伤科学';}
				else if(data[0].project.researchDomainSec=='100509') {researchDomainSecStr='中医妇科学';}
				else if(data[0].project.researchDomainSec=='100510') {researchDomainSecStr='中医儿科学';}
				else if(data[0].project.researchDomainSec=='100511') {researchDomainSecStr='中医五官科学';}
				else if(data[0].project.researchDomainSec=='100512') {researchDomainSecStr='针灸推拿学';}
				else if(data[0].project.researchDomainSec=='100513') {researchDomainSecStr='民族医学';}
				else if(data[0].project.researchDomainSec=='100601') {researchDomainSecStr='中西医结合基础';}
				else if(data[0].project.researchDomainSec=='100602') {researchDomainSecStr='中西医结合临床';}
				else if(data[0].project.researchDomainSec=='100701') {researchDomainSecStr='药物化学';}
				else if(data[0].project.researchDomainSec=='100702') {researchDomainSecStr='药剂学';}
				else if(data[0].project.researchDomainSec=='100703') {researchDomainSecStr='生药学';}
				else if(data[0].project.researchDomainSec=='100704') {researchDomainSecStr='药物分析学';}
				else if(data[0].project.researchDomainSec=='100705') {researchDomainSecStr='微生物与生化药学';}
				else if(data[0].project.researchDomainSec=='100706') {researchDomainSecStr='药理学';}
		    	
		    	if(researchDomainSecStr!='') {
		    		$("#researchDomain").html(researchDomainStr + " &nbsp;&nbsp; 二级学科：" + researchDomainSecStr);
		    	}else {
		    		$("#researchDomain").html(researchDomainStr);
		    	}
		    	
		    	// 主要结局指标信息
		    	if(data[0].projectIndicatorMain!=null) {
		    		$("#indicatorNameMain").html(data[0].projectIndicatorMain.indicatorName);
    			  	$("#indicatorDescriptionMain").html(data[0].projectIndicatorMain.indicatorDescription);
    			  	$("#indicatorTypeMain").html(data[0].projectIndicatorMain.indicatorType);
		    	}
		    	// 次要结局指标信息
		    	var ciyao_domainStr='';
		    	if(data[0].projectIndicatorListMinor!=null) {
		    		if(data[0].projectIndicatorListMinor.length>0) {
		    			ciyao_domainStr+='<DIV style="MARGIN-TOP: 10px" class=zhibiaoTitle>次要结局指标 &gt;&gt;</DIV>';
		    		}
		    		$(data[0].projectIndicatorListMinor).each(function(i) {
		    		  ciyao_domainStr +='<ul style="background-color: #EEEED1; padding-top: 15px; padding-bottom: 15px;">'
									  +'<li class="name">结局指标名称：</li>'
									  +'<li class="inpu">'
									  + data[0].projectIndicatorListMinor[i].indicatorName
									  +'</li>'
									  +'<li class="name">结局指标描述：</li>'
									  +'<li class="inpu">'
									  + data[0].projectIndicatorListMinor[i].indicatorDescription
									  +'</li>'
									  +'<li class="name">结局指标类型：</li>'
									  +'<li class="inpu">'
									  + data[0].projectIndicatorListMinor[i].indicatorType   
									  +'</li>'
									  +'</ul>';
		    		});
		    	}
		    	$("#div_ciyao_indicator_domain").html(ciyao_domainStr);
		    	// 其他结局指标信息
		    	var qita_domainStr='';
		    	if(data[0].projectIndicatorListElse!=null) {
		    		if(data[0].projectIndicatorListElse.length>0) {
		    			qita_domainStr+='<DIV style="MARGIN-TOP: 10px" class=zhibiaoTitle>其他结局指标 &gt;&gt;</DIV>';
		    		}
		    		$(data[0].projectIndicatorListElse).each(function(i) {
		    			 qita_domainStr +='<ul style="background-color: #EEEED1; padding-top: 15px; padding-bottom: 15px;">'
									  +'<li class="name">结局指标名称：</li>'
									  +'<li class="inpu">'
									  + data[0].projectIndicatorListElse[i].indicatorName
									  +'</li>'
									  +'<li class="name">结局指标描述：</li>'
									  +'<li class="inpu">'
									  + data[0].projectIndicatorListElse[i].indicatorDescription
									  +'</li>'
									  +'<li class="name">结局指标类型：</li>'
									  +'<li class="inpu">'
									  + data[0].projectIndicatorListElse[i].indicatorType   
									  +'</li>'
									  +'</ul>';
		    		});
		    	}
		    	$("#div_qita_indicator_domain").html(qita_domainStr);
		    	
		    	//研究对象信息
		    	$("#researchDesignTimer").html(data[0].project.researchDesignTimer);
		    	$("#researchObjectInfo").html(data[0].project.researchObjectInfo);
		    	$("#researchObjectSample").html(data[0].project.researchObjectSample);
		    	$("#inclusionCriteria").html(data[0].project.inclusionCriteria);
		    	$("#exclusionCriteria").html(data[0].project.exclusionCriteria);
		    	$("#sexPreference").html(data[0].project.sexPreference);
		    	$("#minAge").html(data[0].project.minAge);
		    	$("#maxAge").html(data[0].project.maxAge);
		    	// 招募状态
		    	var researchObjectStatus = '';
		    	if(data[0].project.researchObjectStatus=='0') {
		    		researchObjectStatus = '未开始募集';
		    	}else if(data[0].project.researchObjectStatus=='1') {
		    		researchObjectStatus = '正在募集中';
		    	}else if(data[0].project.researchObjectStatus=='2') {
		    		researchObjectStatus = '正在邀请以确定的研究对象入选，而不公开募集';
		    	}else if(data[0].project.researchObjectStatus=='3') {
		    		researchObjectStatus = '项目进行中，但不再募集研究对象';
		    	}else if(data[0].project.researchObjectStatus=='4') {
		    		researchObjectStatus = '项目已结束';
		    	}else if(data[0].project.researchObjectStatus=='5') {
		    		researchObjectStatus = '募集被中断暂停，之后可能继续';
		    	}else if(data[0].project.researchObjectStatus=='6') {
		    		researchObjectStatus = '募集被中止，之后不会继续';
		    	}else if(data[0].project.researchObjectStatus=='7') {
		    		researchObjectStatus = '募集被取消';
		    	}
		    	$("#researchObjectStatus").html(researchObjectStatus);
		    	
		    	$("#researchObjectStart").html(data[0].project.researchObjectStart);
		    	$("#researchObjectEnd").html(data[0].project.researchObjectEnd);
		    	$("#sampleType").html(data[0].project.sampleType);
		    	$("#sampleInfo").html(data[0].project.sampleInfo);
		    	// 其他信息
		    	$("#websiteName").html(data[0].project.websiteName);
		    	$("#websiteUrl").html(data[0].project.websiteUrl);
		    	$("#thesisType").html(data[0].project.thesisType);
		    	if(data[0].project.thesisFilePath!='') {
		    		$("#thesisFilePath_span").html('<a href="' + data[0].project.thesisFilePath + '" target="_blank" >查看附件</a>');
		    	}
		    	// 是否为干细胞项目
		    	if(data[0].project.isStemCellProjects!=null && data[0].project.isStemCellProjects=='1') {
		    		$("#isStemCellProjects").html("是");
		    	}else {
		    		$("#isStemCellProjects").html("否");
		    	}
		     }
		},
		error : function() {
			alert("通信失败！");
		}
	 });
}

 